/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author antonio
 */
@Embeddable
public class CostPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "unit")
    private int unit;
    @Basic(optional = false)
    @NotNull
    @Column(name = "resource")
    private int resource;

    public CostPK() {
    }

    public CostPK(int unit, int resource) {
        this.unit = unit;
        this.resource = resource;
    }

    public int getUnit() {
        return unit;
    }

    public void setUnit(int unit) {
        this.unit = unit;
    }

    public int getResource() {
        return resource;
    }

    public void setResource(int resource) {
        this.resource = resource;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) unit;
        hash += (int) resource;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CostPK)) {
            return false;
        }
        CostPK other = (CostPK) object;
        if (this.unit != other.unit) {
            return false;
        }
        if (this.resource != other.resource) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.CostPK[ unit=" + unit + ", resource=" + resource + " ]";
    }
    
}
